package com.newcapec.lesson3;

import java.io.UnsupportedEncodingException;

/**
 * String面试重灾区
 */
public class Demo2 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String str1 = "123";
        String str2 = new String(str1);
        String str3 = new String("123");
        String str4 = new String();
        String str5 = new String("");
        String str6 = "";
        char[] arr1 = {'a','b','c'};
        System.out.println(new String(arr1));
        System.out.println(new String(arr1,1,2));
        int[] arr2 = {1,97,98};
        System.out.println(new String(arr2,1,2));
        byte[] arr3 = {'a','b','c','d'};
        //System.out.println(new String(arr3,1,2,""));
        String str7 = "中华人民共和国";
        byte[] bytes1 = str7.getBytes("gbk");
        byte[] bytes2 = str7.getBytes("utf-8");
        //System.out.println(bytes.length);
        //System.out.println(new String(bytes,"gbk"));
        String str8 = "";
        String str9 = null;

        String str10 = String.copyValueOf(new char[]{'1', 'b'});
    }
}
